package com.woniuxy.microgoodsserver.auctionmag.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.microgoodsserver.auctionmag.mapper.GoodsMapper;
import com.woniuxy.microgoodsserver.auctionmag.service.GoodsService;
import com.woniuxy.microgoodsserver.bean.GoodsBean;
import com.woniuxy.microgoodsserver.bean.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    GoodsMapper goodsMapper;

    @Override
    public PageInfo<GoodsBean> goodsfindAll(PageRequest pageRequest, GoodsBean goodsBean) {
        return PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getLimit()).
                doSelectPageInfo(()->goodsMapper.goodsFindAll(pageRequest,goodsBean));

    }

    @Override
    public GoodsBean goodsfindAllById(int id) {
        GoodsBean goodsBean = goodsMapper.goodsFindAllById(id);
        return goodsBean;
    }

    @Override
    public int saveGoods(GoodsBean goodsBean) {
        return 0;
    }

    @Override
    public int updateGoods(GoodsBean goodsBean) {
        return 0;
    }

    @Override
    public int delGoods(GoodsBean goodsBean) {
        return 0;
    }
}
